﻿using AssettDatabase.DataAccess;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AssettDatabase
{
    public partial class Form_Main : Form
    {
        public Form_Main()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Add_Assett f2 = new Form_Add_Assett();
            f2.ShowDialog();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Add_Supplier f3 = new Form_Add_Supplier();
            f3.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Add_Customer f4 = new Form_Add_Customer();
            f4.ShowDialog();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Assett_Search f5 = new Form_Assett_Search();
            f5.ShowDialog();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click_1(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Modify_Customer f6 = new Form_Modify_Customer();
            f6.ShowDialog();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Setup f7 = new Form_Setup();
            f7.ShowDialog();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Modify_Supplier f8 = new Form_Modify_Supplier();
            f8.ShowDialog();
        }

        private void BT_Add_Vendor_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Add_Vendor f9 = new Form_Add_Vendor();
            f9.ShowDialog();
        }

        private void button5_Click_1(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Assett_Search f10 = new Form_Assett_Search();
            f10.RetireAsset = true;
            f10.ShowDialog();
        }

        private void BT_Export_Assetts_Click(object sender, EventArgs e)
        {

        }

        private void BT_Upcomming_Renewals_Click(object sender, EventArgs e)
        {
            FormProvider.MainMenu.Hide();
            Form_Assets_ReportFilter f12 = new Form_Assets_ReportFilter();
            f12.ShowDialog();
        }

        private void Form_Main_Load(object sender, EventArgs e)
        {
            DAO mDAO = new DAO();
            mDAO.GetConnectionString();

            if (mDAO.FirstRun == "1")
            {
                MessageBox.Show("You have to set up the program connection settings for the first time.");
                FormProvider.MainMenu.Hide();
                Form_Setup f7 = new Form_Setup();
                f7.ShowDialog();
            }
        }
    }

    public class FormProvider
    {
        public static Form_Main MainMenu
        {
            get
            {
                if (_mainMenu == null)
                {
                    _mainMenu = new Form_Main();
                }
                return _mainMenu;
            }
        }
        private static Form_Main _mainMenu;
    }
}
